#define DEBUG
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

const int maxn=2000, maxm=2000, maxl=200, mods=1000000007;

long long min(long long a, long long b) {
  return a<b ? a : b;
}

long long max(long long a, long long b) {
  return a>b ? a : b;
}

bool mystrcmp(char *a, char *b) {
  return strcmp(a, b)<0;
}

int main() {
  freopen("prefix.in", "r", stdin);
  freopen("prefix.out", "w", stdout);

  static char *s[maxn+1], str[maxn+1][maxl+1];
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i=1; i<=n; i++) {
    s[i] = str[i];
  }
  for (int i=1; i<=n; i++) {
    scanf("%s", s[i]);
  }

  sort(s+1, s+n+1, mystrcmp);

  static int pos[maxn+1];
  for (int i=2; i<=n; i++) {
    for (pos[i]=0; s[i][pos[i]]!='\0' && s[i][pos[i]]==s[i-1][pos[i]]; pos[i]++);
  }

  static long long f[maxn+1][maxm+1];
  f[0][0] = 1;
  for (int i=1; i<=n; i++) {
    int len = strlen(s[i]);
    for (int j=m; j>0; j--) {
      long long lcp = len;
      for (int k=i-1; k>=0 && lcp>pos[i+1]; k--) {
	f[i][j] = (f[i][j]+f[k][j-1]*max(lcp-max(pos[k+1], pos[i+1]), 0)%mods)%mods;
	lcp = min(lcp, pos[k+1]);
      }
    }
  }

  printf("%lld", f[n][m]);

  fclose(stdin);
  fclose(stdout);
  return 0;
}
